/**
 * Callback
 */
import React, { useState, useCallback } from 'react';

export default function Callback() {
  const [count, setCount] = useState(1);
  const [val, setVal] = useState('');

  const callback = useCallback(() => {
    console.log(count);
  }, [count]);

  return (
    <div>
      <h4>{count}</h4>
      <div>
        <button onClick={callback}>aaa</button>
      </div>
    </div>
  );
}
